import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Recommend from '../views/Home/Recommend.vue'
import Rank from '../views/Home/Rank.vue'
import Search from '../views/Home/Search.vue'
import SongList from '../views/Recommend/SongList.vue'
// import Auido from '../views/Home/Auido.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    // 通过重定向 ， 将/重定向/recommend，实现默认显示推荐项
    redirect: "/recommend",
    // 定义二级路由
    children: [
      {
        path: "recommend",
        name: "Recommend",
        component: Recommend,
      },
      {
        path: "rank",
        name: "Rank",
        component: Rank
      },
      {
        path: "search",
        name: "Search",
        component: Search
      },
    ]
  },

  //路由
  // {
  //   path: "/auido",
  //   name: "Auido",
  //   component: Auido
  // },


  {
    path: "/songlist",
    name: "SongList",
    component: SongList
  }






  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  routes
})

export default router
